package com.xuln.junit;

import org.junit.After;
import org.junit.Before;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author xulunan
 */
public class BaseTestCase {
	public static AbstractXmlApplicationContext appContext;

	@Before
	public void initApplicationContext() {
		try {
			if (appContext == null) {
				// String contextPath[] = {
				// "WebRoot/WEB-INF/classes/applicationContext.xml" };
				// appContext = new
				// FileSystemXmlApplicationContext(contextPath);
				appContext = new ClassPathXmlApplicationContext("applicationContext*.xml");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("配置文件加载结束。。。。。");
	}

	@After
	public void runAfterTest() {
		appContext = null;
		System.out.println("测试结束。。。。。");
	}
}
